Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JP-2556: Handle charge spilling out of saturated pixels into neighbors #83

Merged
merged 1 commit into from
May 2, 2022

Conversation

cshanahan1
Copy link
Collaborator

@cshanahan1 cshanahan1 commented Apr 22, 2022

Pixels adjacent to saturated pixels are now also flagged as saturated. By default, every pixel that touches the saturated pixels will also be flagged. The parameter 'n_pix_grow_sat' controls how many pixels out are also flagged, and this can also be set to 0.

Resolves JP-2556

@codecov
Copy link

codecov bot commented Apr 22, 2022

Codecov Report

Merging #83 (07de942) into main (f406aa2) will increase coverage by 0.10%.
The diff coverage is 100.00%.

❗ Current head 07de942 differs from pull request most recent head f047d1a. Consider uploading reports for the commit f047d1a to get more accurate results

@@            Coverage Diff             @@
##             main      #83      +/-   ##
==========================================
+ Coverage   71.79%   71.90%   +0.10%     
==========================================
  Files          16       16              
  Lines        2308     2317       +9     
==========================================
+ Hits         1657     1666       +9     
  Misses        651      651              
Impacted Files Coverage Δ
src/stcal/saturation/saturation.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f406aa2...f047d1a. Read the comment docs.

@cshanahan1 cshanahan1 force-pushed the charge_spill_sat_fix branch from 48f7c76 to 05f70de Compare April 28, 2022 17:49
@cshanahan1 cshanahan1 changed the title flag neighboring pixels JP-2556: Handle charge spilling out of saturated pixels into neighbors Apr 28, 2022
@cshanahan1 cshanahan1 requested review from nden and hbushouse April 28, 2022 21:14
@cshanahan1
Copy link
Collaborator Author

cshanahan1 commented Apr 28, 2022

not sure why jwst tests are failing, they run when i run them myself. looks like maybe it can't access a url?

i opened a pr in romancal to turn off the additional flagging so those tests will pass once that's merged.

@nden
Copy link
Collaborator

nden commented Apr 28, 2022

@cshanahan1 The jwst test failures are unrelated.

@cshanahan1
Copy link
Collaborator Author

@nden yes, ready for review

@hbushouse hbushouse added saturation enhancement New feature or request labels Apr 29, 2022
@cshanahan1 cshanahan1 force-pushed the charge_spill_sat_fix branch from 07de942 to f047d1a Compare April 29, 2022 19:18
Copy link
Collaborator

@nden nden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
The two failures in jwst are not related.

Copy link
Collaborator

@hbushouse hbushouse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Just one question about a potential (but unnecessary) change. Can you tell what kind of effect this has on processing speed, i.e. does it significantly slow down the step at all?

only_sat = np.bitwise_and(gdq_slice, saturated).astype(np.uint8)
box_dim = (n_pix_grow_sat * 2) + 1
struct = np.ones((box_dim, box_dim)).astype(bool)
dialated = ndimage.binary_dilation(only_sat, structure=struct).astype(only_sat.dtype)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this binary_dilation method (never seen it before). Is it possible to use it in a mode where you would send it the entire 4D groupdq array after the initial round of flagging is complete (i.e. the loops over groups and integrations is complete) and have it only expand the flags in the 3rd and 4th axes (i.e. image rows and cols)? That way it could be called just once, instead of within the loops here.

@hbushouse hbushouse merged commit 10aeb09 into spacetelescope:main May 2, 2022
@hbushouse
Copy link
Collaborator

Does this need a change to the top-level saturation_step.py module in the jwst package to add n_pix_grow_sat as user-settable parameter? I'm guessing users might want control of this for off-line processing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request saturation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants